package com.lancoo.edu.platform.operation.backupRestore.controller;

import com.lancoo.edu.platform.operation.backupRestore.domain.bo.BrServerSysSaveBo;
import com.lancoo.edu.platform.operation.backupRestore.service.bo.foreign.BrForeignBoService;
import com.lancoo.edu.platform.operation.commons.controller.base.BaseResultController;
import com.lancoo.edu.platform.operation.commons.dto.BaseResult;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @author lzh
 * @Date 2024/4/7 14:42
 */
@RestController
@RequestMapping("/api/backupRestore/foreign")
@AllArgsConstructor
@Validated
public class BrForeignController extends BaseResultController {

    private final BrForeignBoService brForeignBoService;

    /**
     * 保存服务器系统信息
     *
     * @param saveBoList 服务器系统信息保存接收实体
     * @return 统一返回
     */
    @PostMapping("/save/serverSys")
    public BaseResult saveServerSys(@Valid @RequestBody @NotEmpty(message = "服务器系统信息不能为空")
                                            List<BrServerSysSaveBo> saveBoList) {
        brForeignBoService.saveServerSys(saveBoList);
        return success();
    }
}
